// Pelc 2011 WP

// Load original dataset
clear
use "P2011 WP Rep Data.dta"

// Replication
summarize
display c(k)
mdesc
tabmiss
codebook reporter
gen elogGDPcap = exp(logGDPcap)
summarize

*table 2.1*
reg overhang1 mfn  xchangedum944, cluster(reporter)
mdesc overhang1 mfn  xchangedum944
codebook reporter if e(sample)

*table 2.2*
reg overhang1 mfn logGDPcap logGDPconst  xpolity   logimportsprod  ldc agri  recententrant    xchangedum941 xchangedum942 xchangedum943 if  xchange1994<5, cluster(reporter)
codebook reporter if e(sample)
mdesc overhang1 mfn logGDPcap logGDPconst  xpolity   logimportsprod  ldc agri  recententrant    xchangedum941 xchangedum942 xchangedum943

*table 2.3*
reg overhang1 mfn logGDPcap logGDPconst  xpolity   logimportsprod  ldc agri  recententrant   xchangedum944, cluster(reporter)
mdesc overhang1 mfn logGDPcap logGDPconst  xpolity   logimportsprod  ldc agri  recententrant   xchangedum944
codebook reporter if e(sample)

*table 2.4*
reg overhang1 mfn logGDPcap logGDPconst  xpolity  logimportsprod ldc agri recententrant xchangedum944 ADuserconsist95, cluster(reporter)
mdesc overhang1 mfn logGDPcap logGDPconst  xpolity  logimportsprod ldc agri recententrant xchangedum944 ADuserconsist95
codebook reporter if e(sample)

// IMPUTATION
clear
use "P2011 WP Imp Data.dta"
summarize

mi import flong, m(imp) id(reporter case) imp(mfn-xchangeXAD)

*table 2.1*
mi estimate, esampvaryok post: reg overhang1 mfn  xchangedum944, cluster(reporter)

*table 2.2*
mi estimate, esampvaryok post: reg overhang1 mfn logGDPcap logGDPconst  xpolity   logimportsprod  ldc agri  recententrant    xchangedum941 xchangedum942 xchangedum943 if  xchange1994<5, cluster(reporter)

*table 2.3*
mi estimate, esampvaryok post: reg overhang1 mfn logGDPcap logGDPconst  xpolity   logimportsprod  ldc agri  recententrant   xchangedum944, cluster(reporter)

*table 2.4*
mi estimate, esampvaryok post: reg overhang1 mfn logGDPcap logGDPconst  xpolity  logimportsprod ldc agri recententrant xchangedum944 ADuserconsist95, cluster(reporter)
